# 两个字典求交差集,返回l_diff,l_intersection,r_intersection,r_diff
def dict_diff(dict1, dict2):
    if dict1 is None:
        dict1 = {}
    if dict2 is None:
        dict2 = {}
    l_diff = {}
    l_intersection = {}
    r_intersection = {}
    r_diff = {}
    for key in dict1:
        if key in dict2:
            l_intersection[key] = dict1[key]
            r_intersection[key] = dict2[key]
        else:
            l_diff[key] = dict1[key]
    for key in dict2:
        if key not in dict1:
            r_diff[key] = dict2[key]
    return l_diff, l_intersection, r_intersection, r_diff


# 字典转数组
def dict_to_array(dic):
    if dic is None:
        return []
    array = []
    for key in dic:
        array.append(dic[key])
    return array
